Skip to content

Reject a year field that is not a month - #170

Open
SashaMIT wants to merge 1 commit into
araddon:masterfrom
SashaMIT:codered-year-field
Open

SashaMIT wants to merge 1 commit into
araddon:masterfrom
SashaMIT:codered-year-field

Conversation

@SashaMIT

Copy link
Copy Markdown

Summary

  • ParseAny("2021-032") returned 2 January 2021 at 03:00. The three digits stayed in the Go layout, so 03 was read as an hour and 2 as a day.
  • 2021.032, 2021/032, and 2021:032 did the same. 2021-999 returned 1 January 2021.
  • 2014-04 is still 1 April 2014. 2014.05 is still 1 May 2014. 2013-Feb-03 is still 3 February 2013.

Test plan

  • go test . fails on 2021-032 before the check and passes after

Cursor helped draft the patch. The layouts were checked against Go's reference time.

Made with Cursor

2021-032 was parsed as 2 January 2021 at 03:00. The extra digit stayed in the layout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant